/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jogo;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import jogo.Entidade.JogoStatusEnum;
import jogo.Entidade.PlanoFundo;

/**
 *
 * @author IVAN
 */
public class FrmCreditos extends javax.swing.JFrame
        implements Runnable {

    private PlanoFundo bg;
    private IVariaveisControle statusJogo;
    
    public FrmCreditos(IVariaveisControle jogoStatusTmp) {        
        this.setVisible(true);
        statusJogo = jogoStatusTmp;
        
        initComponents();
        bg = new PlanoFundo("Back2.png");

        createBufferStrategy(2);
        setup();

        Thread t = new Thread(this);
        t.start();
    }
    
    /**
     * Creates new form FrmCreditos
     */    
    public FrmCreditos() {        
        this.setVisible(true);        
        
        initComponents();
        bg = new PlanoFundo("Back2.png");

        createBufferStrategy(2);
        setup();

        Thread t = new Thread(this);
        t.start();
    }

    void setup() {
        
        this.setSize(800, 600);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
          if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
            this.setVisible(false);
            statusJogo.setJogoStatusEnum(JogoStatusEnum.Menu);
            statusJogo.setMenuVisible(true);
        }
    }//GEN-LAST:event_formKeyPressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmCreditos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmCreditos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmCreditos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmCreditos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrmCreditos().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    @Override
    public void run() {
        while (true) {
            Graphics2D g = (Graphics2D) getBufferStrategy().getDrawGraphics();

            g.setColor(Color.BLACK);
            g.fillRect(0, 0, getWidth(), getHeight());
            bg.desenhar(g);

            //Desenha Plano de fundo do menu
            g.setColor(Color.WHITE);
            g.drawString("---Programadores---", 100, 50);
            g.drawString("#André Isano Ando - 090660", 100, 70);
            g.drawString("#Ivan Cesar Godinho - 090660", 100, 90);
            
            g.drawString("---Músicas---", 100, 200);
            g.drawString("#Led Zeppelin - Kashmir", 100, 220);
            g.drawString("#Pantera - Cowboys from Hell", 100, 240);
            g.drawString("#Sepultura - Arise", 100, 260);
            g.drawString("#Slayer - Angel of Death", 100, 280);
            
            g.drawString("---Sprites e Imagens---", 100, 400);
            g.drawString("#Os sprites e as images foram retiradas do jogo Gradius da Konami, 1995 desenvolvido para o console NES da Nintento", 100, 420);            

            g.dispose();

            getBufferStrategy().show();

            try {
                Thread.sleep(10);
            } catch (InterruptedException ex) {
                Logger.getLogger(FrmJogo.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    }   
}